package com.user.controller;

import com.common.domain.entity.ResponseResult;
import com.common.domain.entity.User;
import com.common.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author
 * @Date 2023/8/31 21:47
 **/
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @PostMapping("/register")
    public ResponseResult register(@RequestBody User user){

        return userService.register(user);
    }

    @PutMapping("/userInfo")
    public ResponseResult updateUserInfo(@RequestBody User user){
        return userService.updateUserInfo(user);
    }

    @GetMapping("/userInfo")
    public ResponseResult userInfo(){
        return userService.userInfo();
    }

    @GetMapping("/userUpdatePassword")
    public ResponseResult userUpdatePassword( String oldPassword, String password){
        return userService.userUpdatePassword(oldPassword, password);
    }

}
